<?php session_start();?>
<?php
class User_RegisterController extends Zend_Controller_Action
{

    public function init()
    {
	$this->_helper->layout()->setLayout('register_login');
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        // action body
    }
	
	public function registerAction()
	{
	
	}
	
	public function registerxulyAction(){
    	$username = $this->view->username=$_POST['username'];
    	$password = sha1($this->view->password=$_POST['password']);
    	$email = $this->view->email=$_POST['email'];
    	$this->view->confemail=$_POST['confemail'];
    	$fullname = $this->view->fullname=$_POST['fullname'];
    	$address = $this->view->address=$_POST['address'];
    	$phone = $this->view->phone=$_POST['phone'];
    	$this->view->capcha=$_POST['capcha'];
    	
		$dt = getdate();
		$date = $dt['year'].'/'.$dt['mon'].'/'.$dt['mday'];
		
    	$data = new User_Model_DbTable_Users();
		$lastID = $data->addUser($username, $password, $fullname, $email, $address, $phone, $date, 1);
		$_SESSION['username']=$username;
		$_SESSION['iduser']=$lastID;
    	/*header ('Location: ../../index.php');*/
    	echo "<script>alert('Đăng ký thành công');window.location='../../../index.php';</script>";
    }


}

